﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using DataLib.Common;
using DataLib.Accounts.Bus;

namespace Ewts.BaseData
{
    public partial class RubbishAdd : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
            }
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {

            string strErr = "";
            if (this.txtrubbishname.Text.Trim().Length == 0)
            {
                strErr += "废弃物名称不能为空！\\n";
            }
            if (this.txtrubbishcode.Text.Trim().Length == 0)
            {
                strErr += "废弃物编码不能为空！\\n";
            }
            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            
            string rubbishname = this.txtrubbishname.Text;
            string rubbishcode = this.txtrubbishcode.Text;
         //   bool isdangerous =Convert.ToBoolean( this.ddlisdangerous.SelectedValue);




            DataLib.Model.Rubbish model = new DataLib.Model.Rubbish();

            model.itemName = rubbishname;
            model.itemCode = rubbishcode;
           // model.isdangerous = isdangerous;

            DataLib.BLL.Rubbish bll = new DataLib.BLL.Rubbish();
            bll.Add(model);
            DataLib.Common.MessageBox.ShowAndRedirect(this, "保存成功！", "RubbishAdd.aspx");

        }


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("RubbishList.aspx");
        }
    }
}
